﻿
@{
    ViewBag.Title = "EmergencyPlanAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css{
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
}

<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>编辑应急预案</a>
            </li>
            <li class="crumb-link">
                <a>应急预案</a>
            </li>
            <li class="crumb-trail">编辑应急预案</li>
        </ol>
    </div>
</header>

<div id="content" ng-cloak ng-controller="EmergencyController" ng-init="
     Id='@(Request.QueryString["Id"].IsEmpty() ? "" : Request.QueryString["Id"])';
     page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     GetPlanTypeList();
     ImageCount=[0,1,2,3,4];
     InitImgeUpload3();
     FileList=[];
     GetEmergencyPlanDetail(Id);
     ">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-info panel-border top mb35">
                <div class="panel-heading">
                    <span class="panel-title">编辑应急预案</span>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">预案标题</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" ng-model="EditModel.Title" placeholder="此处输入预案标题" maxlength="100" />
                            </div>
                            <label class="control-label">{{EditModel.Title.length}}/100</label>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">预案类型</label>
                            <div class="col-lg-8">
                                <select class="form-control" ng-model="EditModel.TypeId">
                                    <option>请选择预案类型...</option>
                                    <option ng-repeat="x in PlanTypeList" value="{{x.Id}}">{{x.PlanType}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所有用户可见</label>
                            <div class="col-sm-4">
                                <label>
                                    <label class="radio-inline">
                                        <input type="radio" id="IsPublic1" checked name="IsPublic" ng-click="EditModel.IsPublic = true;" ng-checked="EditModel.IsPublic== true">是
                                    </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <label class="radio-inline">
                                        <input type="radio" id="IsPublic2" name="IsPublic" ng-checked="EditModel.IsPublic== false" ng-click="AddModel.IsPublic = false;">否
                                    </label>
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">关键词</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" placeholder="此处输入关键词..." ng-model="EditModel.Keywords">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label" for="textArea2">摘要</label>
                            <div class="col-lg-8">
                                <textarea class="form-control" id="textArea2" rows="3" ng-model="EditModel.Summary"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">有效期</label>
                            <div class="col-sm-8">
                                <datepicker id="startTime" option="datetimeOption" format="L" ng-model="EditModel.ValidDate"></datepicker>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">版本号</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" placeholder="此处输入版本号..." ng-model="EditModel.Version">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">预案文件列表：</label>
                            <div class="col-sm-8">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th style="width:5%">序号</th>
                                            <th style="width:30%">文件名称</th>
                                            <th style="width:10%">文件大小(kb)</th>
                                            <th style="width:10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="EditModel.FileList.length==0">
                                            <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                        </tr>
                                        <tr ng-repeat="x in EditModel.FileList">
                                            <td ng-bind="$index+1"></td>
                                            <td ng-bind="x.FileName"></td>
                                            <td ng-bind="x.FileSize"></td>
                                            <td>
                                                <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                <a ng-click="DeletePlanFile(Id,x.FileId,EditModel.FileList);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">预案流程图列表：</label>
                            <div class="col-sm-8">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th style="width:5%">序号</th>
                                            <th style="width:30%">文件缩略图</th>
                                            <th style="width:10%">文件大小(kb)</th>
                                            <th style="width:10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="EditModel.FlowChartList.length==0">
                                            <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                        </tr>
                                        <tr ng-repeat="x in EditModel.FlowChartList">
                                            <td ng-bind="$index+1"></td>
                                            <td><img ng-src="{{x.FilePath}}" width="50"></td>
                                            <td ng-bind="x.FileSize"></td>
                                            <td>
                                                <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                <a ng-click="DeletePlanFile(Id,x.FileId,EditModel.FlowChartList);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">上传附件</label>
                            <div class="col-lg-8">
                                <input type="file" ngf-select ng-model="doc.Files" name="docfiles" id="docfiles" class="file" initialPreviewAsData="true" data-show-remove="true" data-show-preview="true" showCancel="false" data-show-upload="false" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">流程图：</label>

                            <div class="col-sm-1" ng-repeat="x in ImageCount" id="imagebox_{{x}}" style="margin-right:20px;margin-left:10px;">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" ng-model="EditModel.Remark" placeholder="此处输入备注" maxlength="100" />
                            </div>
                            <label class="control-label">{{EditModel.Remark.length}}/100</label>
                        </div>
                    </form>
                </div>
                <div class="panel-footer">
                    <div class="col-lg-2"></div>
                    <button type="button" class="btn btn-primary" ng-click="EditPlanForm(EditModel,page);">提交</button>
                    <div class="col-lg-2"></div>
                    <a href="PlanFormPageList?page={{page}}" class="btn btn-warning">返回</a>
                </div>
            </div>
        </div>
    </div>

</div>

@section Js{
    <script src="~/Bussiness/js/libs/upload.js"></script>
    <script src="~/Bussiness/js/pg/EmergencyPlan.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Bussiness/js/libs/moment.min.js"></script>
    <script src="~/Bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Bussiness/js/libs/fileinput.js"></script>
    <script src="~/Bussiness/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh'
        });
    </script>
}